package com.elock.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.PrePersist;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.elock.base.core.entity.BaseEntity;

/**
 * Entity - 终端设备
 * @author 仁德
 */
@Entity
@Table(name = "terminal")
@SequenceGenerator(name = "sequenceGenerator", sequenceName = "terminal_sequence")
public class Terminal extends BaseEntity {

	private static final long serialVersionUID = 1386745660360951034L;

	/** 终端设备编号  全系统唯一*/
	private String terminalNum;

	/** 终端名称 */
	private String terminalName;

	/** 终端SIM卡号 */
	private String sim;

	/** 备注 */
	private String remark;

	/** 类型  */
	private SystemDict type;

	/** 型号  */
	private SystemDict model;

//	/** 版本号 */
//	private String edition;

	/** 是否开启基站定位 */
	private Boolean isJzdw;

	/** 是否手动开锁 */
	private Boolean isManualUnlock;

	/** 是否手动解除报警 */
	private Boolean isManualRemoveWarn;

	/** 车牌号 */
	private String carNumber;

	/**  
	 * 获取sim  
	 * @return sim sim  
	 */
	public String getSim() {
		return sim;
	}

	/**  
	 * 设置sim  
	 * @param sim sim  
	 */
	public void setSim(String sim) {
		this.sim = sim;
	}

	/**  
	 * 获取remark  
	 * @return remark remark  
	 */
	public String getRemark() {
		return remark;
	}

	/**  
	 * 设置remark  
	 * @param remark remark  
	 */
	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getTerminalName() {
		return terminalName;
	}

	public void setTerminalName(String terminalName) {
		this.terminalName = terminalName;
	}

	@Column(unique = true)
	public String getTerminalNum() {
		return terminalNum;
	}

	public void setTerminalNum(String terminalNum) {
		this.terminalNum = terminalNum;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	public SystemDict getType() {
		return type;
	}

	public void setType(SystemDict type) {
		this.type = type;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	public SystemDict getModel() {
		return model;
	}

	public void setModel(SystemDict model) {
		this.model = model;
	}

//	public String getEdition() {
//		return edition;
//	}
//
//	public void setEdition(String edition) {
//		this.edition = edition;
//	}

	/**  
	 * 获取isJzdw  
	 * @return isJzdw isJzdw  
	 */
	public Boolean getIsJzdw() {
		return isJzdw;
	}

	/**  
	 * 设置isJzdw  
	 * @param isJzdw isJzdw  
	 */
	public void setIsJzdw(Boolean isJzdw) {
		this.isJzdw = isJzdw;
	}

	/**  
	 * 获取isManualUnlock  
	 * @return isManualUnlock isManualUnlock  
	 */
	public Boolean getIsManualUnlock() {
		return isManualUnlock;
	}

	/**  
	 * 设置isManualUnlock  
	 * @param isManualUnlock isManualUnlock  
	 */
	public void setIsManualUnlock(Boolean isManualUnlock) {
		this.isManualUnlock = isManualUnlock;
	}

	/**  
	 * 获取isManualRemoveWarn  
	 * @return isManualRemoveWarn isManualRemoveWarn  
	 */
	public Boolean getIsManualRemoveWarn() {
		return isManualRemoveWarn;
	}

	/**  
	 * 设置isManualRemoveWarn  
	 * @param isManualRemoveWarn isManualRemoveWarn  
	 */
	public void setIsManualRemoveWarn(Boolean isManualRemoveWarn) {
		this.isManualRemoveWarn = isManualRemoveWarn;
	}

	/**  
	 * 获取carNumber  
	 * @return carNumber carNumber  
	 */
	public String getCarNumber() {
		return carNumber;
	}

	/**  
	 * 设置carNumber  
	 * @param carNumber carNumber  
	 */
	public void setCarNumber(String carNumber) {
		this.carNumber = carNumber;
	}

	/**
	 * 持久化前处理
	 */
	@PrePersist
	public void prePersist() {
		if (getIsJzdw() == null) {
			setIsJzdw(false);
		}
		if (getIsManualUnlock() == null) {
			setIsManualUnlock(false);
		}
		if (getIsManualRemoveWarn() == null) {
			setIsManualRemoveWarn(false);
		}
	}
}
